import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import yuangong from '@/views/modules/yuangong/list'
    import huiyitongzhi from '@/views/modules/huiyitongzhi/list'
    import discusshuiyiziliao from '@/views/modules/discusshuiyiziliao/list'
    import huiyiyuding from '@/views/modules/huiyiyuding/list'
    import shebeibaoxiu from '@/views/modules/shebeibaoxiu/list'
    import toupiaojilu from '@/views/modules/toupiaojilu/list'
    import discusshuiyishi from '@/views/modules/discusshuiyishi/list'
    import fenlei from '@/views/modules/fenlei/list'
    import huiyishi from '@/views/modules/huiyishi/list'
    import discusshuiyitoupiao from '@/views/modules/discusshuiyitoupiao/list'
    import huiyitoupiao from '@/views/modules/huiyitoupiao/list'
    import huiyiziliao from '@/views/modules/huiyiziliao/list'
    import tongzhigonggao from '@/views/modules/tongzhigonggao/list'
    import config from '@/views/modules/config/list'
    import discussyijianshouji from '@/views/modules/discussyijianshouji/list'
    import yijianshouji from '@/views/modules/yijianshouji/list'


//2.配置路由   注意：名字
export const routes = [{
    path: '/',
    name: '系统首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '系统首页',
      component: Home,
      meta: {icon:'', title:'center', affix: true}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/yuangong',
        name: '用户',
        component: yuangong
      }
      ,{
	path: '/huiyitongzhi',
        name: '会议通知',
        component: huiyitongzhi
      }
      ,{
	path: '/discusshuiyiziliao',
        name: '会议资料评论',
        component: discusshuiyiziliao
      }
      ,{
	path: '/huiyiyuding',
        name: '会议预定',
        component: huiyiyuding
      }
      ,{
	path: '/shebeibaoxiu',
        name: '设备报修',
        component: shebeibaoxiu
      }
      ,{
	path: '/toupiaojilu',
        name: '投票记录',
        component: toupiaojilu
      }
      ,{
	path: '/discusshuiyishi',
        name: '会议室评论',
        component: discusshuiyishi
      }
      ,{
	path: '/fenlei',
        name: '分类',
        component: fenlei
      }
      ,{
	path: '/huiyishi',
        name: '会议室',
        component: huiyishi
      }
      ,{
	path: '/discusshuiyitoupiao',
        name: '会议投票评论',
        component: discusshuiyitoupiao
      }
      ,{
	path: '/huiyitoupiao',
        name: '会议投票',
        component: huiyitoupiao
      }
      ,{
	path: '/huiyiziliao',
        name: '会议资料',
        component: huiyiziliao
      }
      ,{
	path: '/tongzhigonggao',
        name: '通知公告',
        component: tongzhigonggao
      }
      ,{
	path: '/config',
        name: '轮播图管理',
        component: config
      }
      ,{
	path: '/discussyijianshouji',
        name: '意见收集评论',
        component: discussyijianshouji
      }
      ,{
	path: '/yijianshouji',
        name: '意见收集',
        component: yijianshouji
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router;
